using MediatR;
using SumerCoreDevOps.Application.Users.Commands;
using SumerCoreDevOps.Infrastructure.Identity;

namespace SumerCoreDevOps.Application.Users.Handlers;

/// <summary>
/// 锁定用户命令处理器
/// </summary>
public class LockUserCommandHandler : IRequestHandler<LockUserCommand>
{
    private readonly UserManager _userManager;

    public LockUserCommandHandler(UserManager userManager)
    {
        _userManager = userManager;
    }

    public async Task Handle(LockUserCommand request, CancellationToken cancellationToken)
    {
        await _userManager.LockUserAsync(request.UserId, request.Reason, request.LockedBy);
    }
}
